package my.app.company;

import my.app.R;
import my.app.ServiceClient;
import my.app.Settings;
import android.R.integer;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

public class CompanyRating extends Dialog{
	
	Spinner spinner;

	public CompanyRating(Context context) {
		
		
		super(context);
		
		setTitle("Company Rating");
		
		setContentView(R.layout.taxi_rating);
		Spinner s = (Spinner) findViewById(R.id.taxi_rating_spinner);
		spinner = s;
		ArrayAdapter adapter = ArrayAdapter.createFromResource(getContext(), R.array.ratings, android.R.layout.simple_spinner_item);
		s.setAdapter(adapter);
		
		s.setId(4);
		
		
		
		Button b = (Button) findViewById(R.id.taxi_rating_button);
		b.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	Settings s = Settings.getInstance();
            	ServiceClient.getInstance(getContext()).rateCompany(s.getUsername(), spinner.getSelectedItemPosition()+1);
            	dismiss();
            }
        });


		
		

	}
	
	
	
	
	


	
	

	

}
